package hn.cch.spring.boot.controller;

import hn.cch.spring.boot.annotation.ApiAnnotation;
import hn.cch.spring.boot.message.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping(value = "/api")
@RestController
public class ApiController {

    private final static Logger logger = LoggerFactory.getLogger(ApiController.class);

    @ApiAnnotation
    @GetMapping(value = "/get1")
    public ResponseEntity<Response<String>> get1(@RequestParam("string") String string) {
        return ResponseEntity.ok(Response.success(string));
    }

    @ApiAnnotation
    @GetMapping(value = "/get2")
    public ResponseEntity<String> get2(@RequestParam("string") String string) {
        return ResponseEntity.ok(string);
    }

    @ApiAnnotation
    @GetMapping(value = "/get3")
    public String get3(@RequestParam("string") String string) {
        return string;
    }
}
